<template>
  <view class="intent-page" style="padding: 30rpx; background-color: #fff; min-height: 100vh;">
    <!-- 输入值：灰色背景，匹配PPT -->
    <view class="text-area" style="margin: 20rpx 0; display: flex; align-items: center;">
      <text style="font-size: 28rpx; color: #333; width: 120rpx;">输入值:</text>
      <input 
        type="text" 
        v-model="title" 
        style="color: #000; background-color: #ddd; border: none; padding: 15rpx; flex: 1; border-radius: 4rpx;" 
        placeholder="输入要传给CompA的值"
      />
    </view>

    <!-- 回传值：灰色背景，匹配PPT -->
    <view class="text-area" style="margin: 20rpx 0; display: flex; align-items: center;">
      <text style="font-size: 28rpx; color: #333; width: 120rpx;">回传值:</text>
      <input 
        type="text" 
        :value="callBackValue" 
        style="color: #000; background-color: #ddd; border: none; padding: 15rpx; flex: 1; border-radius: 4rpx;" 
        readonly
      />
    </view>

    <CompA :intent="title" style="margin: 30rpx 0;"></CompA>
    <CompB @callBackFun="handleCallBack" style="margin: 30rpx 0;"></CompB>
  </view>
</template>

<script>
import CompA from "../../components/CompA.vue";
import CompB from "../../components/CompB.vue";

export default {
  components: {
    CompA,
    CompB
  },
  data() {
    return {
      title: "",
      callBackValue: ""
    };
  },
  methods: {
    handleCallBack(msg) {
      this.callBackValue = msg;
    }
  }
};
</script>

<style scoped>
.text-area {
  display: flex;
  align-items: center;
}
</style>